package cn.lkk.utils;

import java.io.InputStream;
import java.util.Scanner;

/**
 * 打印工具类，该类包含了一些便捷的打印方法
 */
public class PrintUtils {
    public static String RESULT_PRINT_FORMAT = "%1$-8s = %2$s%n";

    public static void printExpressionResult(String expression, Object result) {
        System.out.printf(RESULT_PRINT_FORMAT, expression, result);
    }

    /**
     * 将输入流中的数据以字符的形式打印到控制台中
     */
    public static void printContent(InputStream in) {
        Scanner scanner = new Scanner(in);
        if (scanner.hasNextLine())
            System.out.println(scanner.nextLine());
    }
}
